package com.fyzk.activity.prize.item;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;

import com.fyzk.activity.app.App;
import com.fyzk.data.AppLotteryInfos;
import com.tyjc.lottery.R;
import com.fyzk.utils.LotteryIDUtils;
import com.fyzk.utils.ScreenUtils;

public class AHK3PrizeItem extends PL3PrizeItem implements
		PrizeNumFormatInterface {

	@Override
	public String getLotteryName() {
		return AppLotteryInfos.getLotteryName(LotteryIDUtils.ANHUIK3_LOTTERY_ID_INT);
	}

	@Override
	public int getLogoResID() {
		return R.drawable.main_ahk3;
	}

	@Override
	public void initNumView(View view) {
		LinearLayout layout = (LinearLayout) view;
		layout.removeAllViews();
		float density = ScreenUtils.getInstance().getDensity();
		String prizeNum = this.getPrizeNum();
		String[] nums = prizeNum.split(",");
		int arr_length = nums.length;
		for (int i = 0; i < arr_length; i++) {
			
			int num = 1;
			try{
				num = Integer.parseInt(nums[i].trim());
			}catch(Exception e){
				num = 1;
			}
				
			ImageView mTxt_ball = new ImageView(App.getContext());
			LayoutParams layoutParams = new LayoutParams((int)(20*density),
					(int)(20*density));

			mTxt_ball.setLayoutParams(layoutParams);
			if (i != 0) {
				layoutParams.setMargins(ballLeftMargin, 0, 0, 0);
			}
			int resId = R.drawable.prize_1;
			switch (num) {
			case 1:
				resId = R.drawable.prize_1;
				break;
			case 2:
				resId = R.drawable.prize_2;
				break;
			case 3:
				resId = R.drawable.prize_3;
				break;
			case 4:
				resId = R.drawable.prize_4;
				break;
			case 5:
				resId = R.drawable.prize_5;
				break;
			case 6:
				resId = R.drawable.prize_6;
				break;
			default:
				resId = R.drawable.prize_6;
				break;
			}
			mTxt_ball.setImageResource(resId);
			layout.addView(mTxt_ball);
		}
	}

}
